package com.lune.blog.api.factory;


import com.lune.blog.api.feign.UserServiceFeign;
import com.lune.blog.base.result.CommonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author yanjizhw@163.com
 * @date 2021/11/9 21:44
 * 描述:
 * @since 1.0.0
 */
@Component
public class UserFallbackFactory implements FallbackFactory<UserServiceFeign> {

    @Override
    public UserServiceFeign create(Throwable throwable) {
        return (username -> CommonResult.failed("获取用户失败:" + throwable.getMessage()));
    }
}
